﻿/****************************** Module Header ******************************\
 * Module Name:  mxDataTable.cs
 * Module Version:  1.0.0 (2013-8-7)
 * Copyright (c) AnyEB.Com (14507247@qq.com)
 * 
 * This class is used to extension collection instance's method.  It supplies 
 * useful extension methods, such as ToString(), FetchString() and so on.
 * 
 * This source is subject to the GPL License.
 * See http://www.gnu.org/licenses/gpl.html.
 * All other rights reserved.
 * 
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.OleDb;
using System.Text;

namespace UCL.Data
{

    /// <summary>
    /// 数据表对象扩展类
    /// </summary>
    public static class mxDataTable
    {
        /// <summary>
        /// 保存到Excel
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="filePath"></param>
        /// <param name="sheetName"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        public static string SaveToExcel(this DataTable dt, string filePath, string sheetName = "Sheet1", string filter = "")
        {
            if (dt == null) return "DataTable is null!";
            return new ExcelHelper(filePath).SaveToExcel(dt, sheetName, filter);
        }
    }
}
